import sys
sys.path.append("..")
import Cust.leancloudapi
def getAllDictionary(request):
    Diction = Cust.leancloudapi.GetApi()
    DictionaryM = Diction.getDictionary()
    query = DictionaryM.query
    query.limit(1000)
    res = query.equal_to('Type','term').find()
    college_list = []
    term_list = []
    for item in res:
      term_name = item.get('Key')
      term_value = item.get('Value')
      term = {'Term_Name':term_name,'Term_Value':term_value}
      term_list.append(term)
    res_c = query.equal_to('Type','college').find()
    for item_c in res_c:
      college_name = item_c.get('Key')
      college_value = item_c.get('Value')
      college = {'college_name':college_name,'college_value':college_value}
      college_list.append(college)
    content = {'Term':term_list,'College':college_list}
    return content
